import { http } from '@/utils/http'

/**
 * 获取农产品分类
 * @returns Promise<IResData<IQuoteCategory[]>>
 */
export function quoteCategory(): Promise<IResData<IQuoteCategory[]>> {
  return http.get('/api/nongshang/product_type')
}

/**
 * 获取农产品列表
 * @returns Promise<IResData<IQuote[]>>
 */
// eslint-disable-next-line camelcase
export function quoteList(date: string, product_type_id): Promise<IResData<IQuote[]>> {
  // eslint-disable-next-line camelcase
  return http.get('/api/nongshang/product', { date, product_type_id })
}

/**
 * 获取农产品历史列表
 * @returns Promise<IResData<IQuoteHistory[]>>
 */
export function quoteHistoryList(params: IQuoteHistoryParams): Promise<IResData<IQuoteHistory[]>> {
  return http.get('/api/nongshang/product_history', params)
}

/**
 * 获取农产品详情
 * @param product_id string
 * @returns Promise<IResData<IQuote>>
 */
// eslint-disable-next-line camelcase
export function quoteDetail(product_id: number): Promise<IResData<IQuote>> {
  // eslint-disable-next-line camelcase
  return http.get(`/api/nongshang/product_detail`, { product_id })
}
